<?php
/*
  $Id: upcoming_products.php,v 1.1.1.3 2004/04/07 23:42:23 ccwjr Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2004 osCommerce

  Released under the GNU General Public License
*/

  $expected_query = tep_db_query("select p.products_id, pd.products_name, products_image, p.products_price, products_tax_class_id, products_description, products_date_available as date_expected from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where to_days(products_date_available) >= to_days(now()) and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by " . EXPECTED_PRODUCTS_FIELD . " " . EXPECTED_PRODUCTS_SORT . " limit " . MAX_DISPLAY_UPCOMING_PRODUCTS);
  if (tep_db_num_rows($expected_query) > 0) {
?>
<!-- upcoming_products mainpage_modules //-->
<?php
echo '<table cellspacing="0" cellpadding="0" width="100%" border="0">';
// BOF: Lango Added for template MOD
if (MAIN_TABLE_BORDER == 'yes'){
  table_image_border_top2(false, false, sprintf(TABLE_HEADING_UPCOMING_PRODUCTS));
} else {
echo sprintf(TABLE_HEADING_UPCOMING_PRODUCTS);
}

// EOF: Lango Added for template MOD
echo '<table cellspacing="0" cellpadding="0" width="100%" border="0" class="product">';

  $row = 0;
  $col = 0;
  $rows=0;
  $colum=0;
    while ($expected = tep_db_fetch_array($expected_query)) {
      $row++;
    
	$r_name = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $expected['products_id']) . '">' . $expected['products_name'] . '</a>';
	
    $r_pic = tm_image_border('<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $expected['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $expected['products_image'], $expected['products_name'], MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT) . '</a>');
 
	if (tep_get_products_special_price($expected['products_id'])) {
		  $r_price = '<s>' .  $currencies->display_price($expected['products_price'], tep_get_tax_rate($expected['products_tax_class_id'])) . '</s>' . PRICE_SEPARATOR . '<span class="productSpecialPrice">' . $currencies->display_price(tep_get_products_special_price($expected['products_id']), tep_get_tax_rate($expected['products_tax_class_id'])) . '</span>';

		} else {
		  $r_price = '<span class="productSpecialPrice">' . $currencies->display_price($expected['products_price'], tep_get_tax_rate($expected['products_tax_class_id'])) . '</span>';
		}
		
	$r_desc = substr($expected['products_description'],0,MAX_DESC_MODULE).'...';
		
	$r_view = '<a href="' . tep_href_link('product_info.php','products_id=' . $expected['products_id']) . '">' .tep_image_button('button_details.gif').'</a>';

	$r_buy = '<a href="'.tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $expected['products_id']).'">' .tep_image_button('button_in_cart.gif').'</a>';
	
	
      
echo tep_list_products_row ($r_pic, $r_name, $r_price, $r_desc, $r_view, $r_buy);


      $column ++;
      if ($column >= COLUMN_COUNT) {
        $row ++;
        $column = 0;
      }
    }


  echo '</table>';


if (MAIN_TABLE_BORDER == 'yes'){
  table_image_border_bottom2(false, false, '');
}

  echo '</table>
  
  <img src="'.DIR_WS_TEMPLATES . TEMPLATE_NAME.'/images/spacer.gif" alt="" width="1" height="4" /><br>';
    }
?>
<!-- upcoming_products_eof //-->